data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -1263.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.2444 -0.3497 -0.0832 0.1955 6.3116
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000002079 0.001442
## Residual 0.000013235 0.003638
## Number of obs: 186, groups: stateID, 34
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -0.0137678378 0.0097218158 81.7517433858
## Affluence 0.0043808501 0.0010921351 117.7613495334
## Singletons.in.Tract 0.0005614038 0.0009014385 157.0024855703
## Seniors.in.Tract 0.0002196420 0.0011761408 163.9898953488
## African.Americans.in.Tract 0.0011297070 0.0010046179 162.5732458815
## Noncitizens.in.Tract 0.0010587247 0.0007511198 127.7482847045
## High.BP 0.0001366756 0.0001873187 125.7707667950
## Binge.Drinking 0.0002332299 0.0001630168 52.8113561971
## Cancer -0.0012106131 0.0011052476 122.5239395969
## Asthma 0.0008843084 0.0005708531 55.8297901669
## Heart.Disease 0.0019095163 0.0013399841 89.8216617288
## COPD -0.0004553023 0.0011073913 87.9195289066
## Smoking -0.0000452274 0.0002305638 94.4650899643
## Diabetes -0.0006012543 0.0005426570 91.0538300290
## No.Physical.Activity -0.0000152144 0.0002094629 105.4440670776
## Obesity 0.0002643811 0.0001764230 126.3845809812
## Poor.Sleeping.Habits -0.0000435769 0.0001630557 139.4188310145
## Poor.Mental.Health -0.0000885639 0.0004429728 37.6633161202
## Testing_Rate 0.0000006661 0.0000002627 45.9929173709
## Hospitalization_Rate -0.0000824114 0.0000952874 31.1767480819
## t value Pr(>|t|)
## (Intercept) -1.416 0.160522
## Affluence 4.011 0.000106 ***
## Singletons.in.Tract 0.623 0.534328
## Seniors.in.Tract 0.187 0.852089
## African.Americans.in.Tract 1.125 0.262453
## Noncitizens.in.Tract 1.410 0.161109
## High.BP 0.730 0.466966
## Binge.Drinking 1.431 0.158404
## Cancer -1.095 0.275520
## Asthma 1.549 0.127008
## Heart.Disease 1.425 0.157614
## COPD -0.411 0.681964
## Smoking -0.196 0.844906
## Diabetes -1.108 0.270788
## No.Physical.Activity -0.073 0.942234
## Obesity 1.499 0.136480
## Poor.Sleeping.Habits -0.267 0.789670
## Poor.Mental.Health -0.200 0.842610
## Testing_Rate 2.535 0.014699 *
## Hospitalization_Rate -0.865 0.393715
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence 0.078
## Sngltns.n.T 0.008 0.042
## Snrs.n.Trct 0.528 0.363 0.172
## Afrcn.Am..T 0.155 0.158 -0.406 0.151
## Nnctzns.n.T 0.033 0.098 0.069 0.089 -0.107
## High.BP -0.053 0.213 0.048 0.073 -0.098 0.389
## Bing.Drnkng -0.309 -0.164 -0.283 -0.156 0.065 0.001 0.129
## Cancer -0.574 -0.161 0.196 -0.296 -0.075 -0.150 -0.345 -0.100
## Asthma -0.391 -0.188 -0.237 -0.202 0.076 0.053 0.170 -0.010 0.054
## Heart.Dises -0.151 0.094 -0.297 -0.146 0.254 -0.119 0.005 0.058 -0.485
## COPD 0.573 -0.005 0.150 0.262 -0.028 0.285 0.135 0.085 -0.266
## Smoking -0.138 0.162 -0.184 -0.098 -0.036 0.038 -0.058 -0.292 0.076
## Diabetes 0.108 -0.333 -0.100 -0.207 -0.299 -0.288 -0.530 0.053 0.235
## N.Physcl.Ac -0.216 -0.008 0.090 -0.022 -0.035 -0.225 -0.067 0.111 0.484
## Obesity 0.016 0.408 0.437 0.304 0.130 0.174 -0.101 -0.232 0.093
## Pr.Slpng.Hb -0.432 -0.401 0.148 -0.336 -0.334 -0.020 -0.173 0.113 0.121
## Pr.Mntl.Hlt -0.352 0.277 -0.068 -0.044 0.091 -0.190 -0.050 0.082 0.325
## Testing_Rat 0.241 -0.077 0.005 0.033 0.033 -0.024 -0.033 -0.023 -0.213
## Hsptlztn_Rt -0.140 -0.190 -0.068 -0.223 -0.073 -0.097 -0.062 -0.135 0.016
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.282
## COPD -0.391 -0.564
## Smoking 0.086 0.201 -0.495
## Diabetes -0.128 -0.315 -0.061 0.223
## N.Physcl.Ac 0.040 -0.376 -0.016 -0.331 -0.106
## Obesity -0.275 -0.084 0.156 -0.194 -0.372 -0.048
## Pr.Slpng.Hb 0.086 0.239 -0.168 -0.062 -0.030 -0.112 -0.168
## Pr.Mntl.Hlt -0.240 0.094 -0.468 0.081 0.018 0.057 0.059 -0.164
## Testing_Rat -0.348 -0.040 0.226 0.140 0.120 -0.322 0.138 -0.149 -0.149
## Hsptlztn_Rt 0.096 0.104 -0.107 0.073 0.009 -0.004 -0.013 -0.003 -0.091
## Tstn_R
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb
## Pr.Mntl.Hlt
## Testing_Rat
## Hsptlztn_Rt 0.106
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)", data = county.Demo_and_Covid.500counties)
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -2448.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7251 -0.3792 -0.0778 0.2647 6.7047
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000007639 0.002764
## Residual 0.000012331 0.003512
## Number of obs: 326, groups: stateID, 51
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) -0.02272680 0.00792033 194.66846846 -2.869
## Affluence 0.00290302 0.00071753 302.85783904 4.046
## Singletons.in.Tract 0.00081203 0.00066931 300.68924552 1.213
## Seniors.in.Tract 0.00041518 0.00084551 304.35453945 0.491
## African.Americans.in.Tract 0.00175146 0.00081741 306.66138653 2.143
## Noncitizens.in.Tract 0.00179018 0.00066040 273.33539751 2.711
## High.BP -0.00001546 0.00014808 299.60754399 -0.104
## Binge.Drinking 0.00039750 0.00015603 161.67302985 2.548
## Cancer -0.00034360 0.00086920 268.11913096 -0.395
## Asthma 0.00072204 0.00051738 143.52223176 1.396
## Heart.Disease 0.00308413 0.00111621 214.10545211 2.763
## COPD -0.00126301 0.00084507 208.34195421 -1.495
## Smoking -0.00020991 0.00019519 253.74331189 -1.075
## Diabetes -0.00114613 0.00041818 270.94653985 -2.741
## No.Physical.Activity 0.00031281 0.00016806 240.19605631 1.861
## Obesity 0.00023618 0.00013584 307.91957919 1.739
## Poor.Sleeping.Habits 0.00025424 0.00013088 297.87722422 1.942
## Poor.Mental.Health -0.00015554 0.00043944 104.89407784 -0.354
## Pr(>|t|)
## (Intercept) 0.00457 **
## Affluence 0.0000662 ***
## Singletons.in.Tract 0.22599
## Seniors.in.Tract 0.62375
## African.Americans.in.Tract 0.03292 *
## Noncitizens.in.Tract 0.00714 **
## High.BP 0.91689
## Binge.Drinking 0.01178 *
## Cancer 0.69293
## Asthma 0.16500
## Heart.Disease 0.00623 **
## COPD 0.13654
## Smoking 0.28323
## Diabetes 0.00654 **
## No.Physical.Activity 0.06393 .
## Obesity 0.08309 .
## Poor.Sleeping.Habits 0.05302 .
## Poor.Mental.Health 0.72408
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence -0.053
## Sngltns.n.T -0.054 0.042
## Snrs.n.Trct 0.392 0.293 0.073
## Afrcn.Am..T 0.241 0.076 -0.404 0.202
## Nnctzns.n.T -0.072 0.153 0.125 0.058 -0.191
## High.BP -0.094 0.158 0.098 0.008 -0.232 0.325
## Bing.Drnkng -0.490 -0.038 -0.205 -0.067 0.041 -0.076 0.148
## Cancer -0.494 -0.095 0.231 -0.171 -0.074 -0.065 -0.330 -0.018
## Asthma -0.270 -0.095 -0.262 -0.122 -0.015 0.212 0.050 0.010 -0.157
## Heart.Dises -0.059 0.079 -0.302 -0.132 0.213 -0.055 0.001 0.034 -0.603
## COPD 0.479 0.008 0.130 0.171 -0.007 0.156 0.057 0.058 -0.211
## Smoking -0.042 0.105 -0.119 -0.138 -0.104 0.159 -0.082 -0.327 0.156
## Diabetes 0.036 -0.302 -0.078 -0.132 -0.230 -0.251 -0.447 0.074 0.369
## N.Physcl.Ac -0.116 0.035 0.102 0.079 0.059 -0.275 0.004 0.128 0.335
## Obesity -0.066 0.382 0.398 0.201 0.133 0.193 -0.103 -0.146 0.118
## Pr.Slpng.Hb -0.384 -0.349 0.162 -0.325 -0.321 -0.046 -0.156 0.087 0.028
## Pr.Mntl.Hlt -0.353 0.184 -0.008 0.024 0.052 -0.164 0.029 0.130 0.416
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.335
## COPD -0.321 -0.492
## Smoking 0.144 0.084 -0.475
## Diabetes -0.106 -0.434 -0.006 0.277
## N.Physcl.Ac -0.021 -0.359 0.088 -0.274 -0.168
## Obesity -0.124 -0.020 0.091 -0.220 -0.375 -0.044
## Pr.Slpng.Hb 0.000 0.239 -0.092 -0.169 -0.061 -0.153 -0.115
## Pr.Mntl.Hlt -0.438 -0.065 -0.390 -0.029 0.071 -0.088 0.024 -0.080
testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]
col.state <- rep("pink", nrow(testing.data.state))
avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)
col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"
par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")
Pink highlights the last 14 days.
day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)
twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))
par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$rise.cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Cases of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$rise.deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Deaths of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)